package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Social;
import com.xx.pmis.persistence.dao.SocialDAO;
import com.xx.pmis.services.SocialService;

public class SocialServiceImpl implements SocialService {
	SocialDAO socialDAO = null;

	public SocialServiceImpl(SocialDAO socialDAO) {
		super();
		this.socialDAO = socialDAO;
	}

	public void saveOrUpdateSocial(Social social) throws Exception {
		socialDAO.saveOrUpdate(social);
	}

	public void saveSocial(Social social) throws Exception {
		socialDAO.save(social);
	}

	public void deleteSocial(Social social) throws Exception {
		socialDAO.delete(social);
	}

	public Social getSocialBySocialID(String socialID) throws Exception {
		Social social = socialDAO.getSocialBySocialID(socialID);
		return social;
	}

	public List<Social> getAllSocialOfMonth(String year, String month) throws Exception {
		List<Social> socials = socialDAO.getAllSocialOfMonth(year, month);
		return socials;
	}

	public List<Social> getAllSocialOfMonthByPage(int currentPage, int lineSize, String year, String month) throws Exception {
		List<Social> socials = socialDAO.getAllSocialOfMonthByPage(currentPage, lineSize, year, month);
		return socials;
	}

	public int getCountOfSocialOfMonth(String year, String month) throws Exception {
		return socialDAO.getAllSocialOfMonth(year, month).size();
	}


}
